<html>
<head>
<title>Step 1: Barista Application</title>
</head>
<body>
<h1>Step 3: Barista Application</h1>

<p> An application will always include the method <tt>__init__</tt> and at least one
method to define a form that the user of this application will use to complete a given task.
</p>

<h2>Modify the <tt>__init__</tt> method</h2>

<p>This <tt>__init__</tt> method is called automatically when we run the code in this file.
As with the <tt>OrderTakerApplication</tt> there are two lines of code, both of which you will
need to edit.  The first line of code tells WMP which workflow and role this application is associated with.
The second line of code tells WMP what kind of user interface is needed and where to
find the code to build that interface. We will edit each of these lines of code in turn:</p>

<h3>Editing the First Line of Code</h3>

<p>To fix this line of code you need to replace <tt>"WorkflowName"</tt> and <tt>"RoleName"</tt> with the actual
name you gave your workflow in <tt>CoffeeBackend</tt> and the actual name you gave the barista
role (also in <tt>CoffeeBackend</tt>).</p>

<h3>Editing the Second Line of Code</h3>

<p>To fix the second line of code you need to make a couple of edits:</p>
<ol>
<li>You need to replace <tt>"TaskName"</tt> with the actual name
you gave this task in <tt>CoffeeBackend</tt>.</li>

<li>In <tt>OrderTakerApplication</tt> that was the only change you needed to make but
<tt>BaristaApplication</tt> uses a different kind of interface because it needs to
allow the user to select which order to work with.  This was not true
for <tt>OrderTakerApplication</tt> because it is the first step in the workflow and
does not need to reference any existing data.  This different treatment is
indicated by the use of <tt>register_sink_step</tt> in the second line of code
(as opposed to <tt>register_source_step</tt>).

<p>Because of this difference, there is an additional parameter to edit in this
second line of code:  the <tt>name_fields parameter</tt>. The barista will be shown a 
list of pending orders.  Each order on the list will be identified by some kind of 
description taken from the data for that order. Typically the description would be the 
drink to prepare and perhaps the name of the customer.  The <tt>name_fields</tt> parameter allows 
you to define which fields are used to generate this description.</p>

<p>As shown below this list of fields is contained in square brackets.  It should
always start with the <tt>sequence</tt> field, which is a number generated by WMP for
each order on the list.</p>
 
<p>For Lab 5:  replace <tt>FieldName1</tt> and <tt>FieldName2</tt> below with the names of actual
fields associated with the order.  You decided on these field names when you
set up the form in the <tt>OrderTakerApplication</tt>.  Note that you can use just
one field or more than three.  You should choose the fields you think the barista
should see when looking at a list of orders.</p>
</li>
</ol>

<h2>Modify the <tt>prepare_drink_form_creator</tt> method</h2>

<p>This method defines the form that appears to the Barista, when he chooses and order to process.<br>
The form consists of three parts:</p>

<ol>
        
<li>A label that describes this particular order.  This label should include one or more fields
from the order data that was collected in <tt>OrderTakerApplication</tt>.  It could be the same fields
you specified in the <tt>name_fields parameter</tt> in the init method above.  

For Lab 5:  You should specify these fields by editing the <tt>fields=</tt> parameter for 
the <tt>add_task_label</tt> function, already included.</li>

<li>A list of fields that the barista needs to enter or edit for this drink order.
Note: that you don't have to include any fields at all if there is no information you need
to capture from the barista.  

For Lab 5:  optionally add any fields or static text you want to include in the form.</li>

<li>A button that the barista clicks to indicate this order has been prepared.  This
button is automatically generated by WMP.  Note that even if you don't include any
new fields for the barista to fill in, he or she will still need to click this button
to signal that the order is complete, at which point WMP will update the status of the order
in the Spreadsheet.</li>
</ol>

</body>
</html>